package com.yeban.javase.day16.created;

/**
 * @Desc TODO
 * @Author yeban
 * @Date 2025/10/29
 */
public class ThreadDemo {

    public static void main(String[] args) {

        // 匿名内部类
        Thread thread = new Thread() {
            @Override
            public void run() {
                int sum = 0;
                for (int i = 0; i < 10; i++) {
                    System.out.println(Thread.currentThread().getName() + " --- " + (i+1));
                }
            }
        };

        // Lanbda表达式
        // 无返回值
        Thread thread1 = new Thread(() -> {
            for (int i = 0; i < 10; i++) {
                System.out.println(Thread.currentThread().getName() + " --- " + (i+1));
            }
        });

        thread.start();
    }
}
